# coding=utf-8
# Date: 2021/9/5 13:55
import random


def rand7():
    return random.randint(1, 7)


# 执行用时：264 ms, 在所有 Python3 提交中击败了85.23%的用户
# 内存消耗：17.4 MB, 在所有 Python3 提交中击败了57.52%的用户
class Solution:
    def rand10(self):
        """
        :rtype: int
        """
        t = (rand7() - 1) * 7 + rand7()
        if t > 40:
            t = self.rand10()
        return (t - 1) % 10 + 1


if __name__ == "__main__":
    for _ in range(10):
        print(Solution().rand10())
